/////////////////////////////////////////////////////////////////////////////////////////////
// Filename: BaseGameEntity.h
//
// Entities must remember to register and remove themselves in thier c/dtors.
//
// (c) Dave Ottley, 2012. All rights reserved.
/////////////////////////////////////////////////////////////////////////////////////////////
#ifndef BASEGAMEENTITY_H
#define BASEGAMEENTITY_H

///////////////////////////
//		INCLUDES
///////////////////////////
#include <stdint.h>
#include <assert.h>

///////////////////////////
//		MY INCLUDES
///////////////////////////
#include "Abstract.h"
#include "EntityManager.h"

struct Telegram;


class BaseGameEntity : public Abstract
{
private:
	static uint32_t mNextValidID;
	uint32_t		mID;

public:
	// PUBLIC INTERFACE
	BaseGameEntity() { SetID(); EntityMgr->RegisterEntity(this); }
	virtual ~BaseGameEntity() { EntityMgr->RemoveEntity(this); }
	virtual void Update() = 0; 
	uint32_t GetID() const { return mID; }
	virtual bool HandleMessage(const Telegram& telegram) { assert(false && "No message handler defined"); return false; } 

private:
	// IMPLEMENTATION
	void SetID() { mID = mNextValidID++; }
};
	

#endif // BASEGAMEENTITY_H